#ifndef __OVERLOAD_H
#define __OVERLOAD_H

/* arguments overload indirect function */
#define _OVERLOAD(func, p0, p1, p2, p3, p4, p5, p6, p7, number, ...) \
                    func##number(p0, p1, p2, p3, p4, p5, p6, p7)
/* arguments overload distribute interface */
#define OVERLOAD(func, ...) _OVERLOAD(func, __VA_ARGS__, 7, 6, 5, 4, 3, 2, 1, 0)

/**
 * @sample:
 *      #define MYFUNC(...) OVERLOAD(myfunc, __VA_ARGS__)                       // the overload function entry-point definition
 *      #define myfunc0(p0, p1, p2, p3, p4, p5, p6, p7) real_func0(p0)          // call the real function of 1 argument
 *      #define myfunc1(p0, p1, p2, p3, p4, p5, p6, p7) real_func1(p0, p1)      // call the real function of 2 arguments
 *      #define myfunc2(p0, p1, p2, p3, p4, p5, p6, p7) real_func2(p0, p1, p2)  // call the real function of 3 arguments
 *      ......
 * @note:
 *      only support 1 argument or more than 1 argument overload, because there is no difference between pass in 1 argument or pass in 0 arguments
 *      to the `MYFUNC` macro, the `__VA_ARGS__` always take up a place.
 */

#endif
